Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrSochitiet_thanhtoan
    Private matk, tentk As String
    Private thangnam As Date
    Private vtrang As Integer
    Private customerReport As ReportDocument

    Private Sub FrmCrSochitiet_thanhtoan_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim tiendauky As Double = 0
        Dim sqlQuery As String = ""
        Dim data_temp As DataTable
        Dim nodauvn As Double = 0
        Dim codauvn As Double = 0
        sqlQuery = "SELECT nodauvn, codauvn from tbl_dot_temp_socai WHERE soCT = 'ZZZZZZZZ'"
        data_temp = moduleDatabaseConn.GetDataTable(sqlQuery)
        If data_temp.Rows.Count > 0 Then
            Try
                nodauvn = data_temp.Rows.Item(0).Item(0)
                codauvn = data_temp.Rows.Item(0).Item(1)
            Catch ex As Exception
            End Try
        End If

        sqlQuery = "SELECT * from tbl_dot_temp_socai ORDER BY ngayGS "
        Dim reportPath = Application.StartupPath & "\" & "crSochitiet_thanhtoan.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("TMatk", matk)
        customerReport.SetParameterValue("TTentk", tentk)
        customerReport.SetParameterValue("TThangnam", thangnam)
        customerReport.SetParameterValue("TTrang", vtrang)
        customerReport.SetParameterValue("nodauvn", nodauvn)
        customerReport.SetParameterValue("codauvn", codauvn)
        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        Me.CrNXTTongHopview.ReportSource = customerReport
    End Sub
    Public Sub setVtrang(ByVal s As Integer)
        vtrang = s
    End Sub

    Public Sub setMatk(ByVal s As String)
        matk = s
    End Sub
    Public Sub setTentk(ByVal s As String)
        tentk = s
    End Sub

    Public Sub setThangnam(ByVal s As Date)
        thangnam = s
    End Sub
End Class
